package com.evony.common.server.events 
{
    import com.evony.common.*;
    import com.evony.common.beans.*;
    import mx.collections.*;
    
    public class ColonyUpdate extends com.evony.common.BaseBean
    {
        public function ColonyUpdate(arg1:String, arg2:Object, arg3:Boolean=false, arg4:Boolean=false)
        {
            var loc1:*=0;
            var loc2:*=null;
            colonyBeansArray = new mx.collections.ArrayCollection();
            super(arg1, arg3, arg4);
            if (arg2.castleId != null) 
            {
                this.castleId = arg2.castleId;
            }
            if (arg2.colonyBeans) 
            {
                loc1 = 0;
                while (loc1 < arg2.colonyBeans.length) 
                {
                    loc2 = new com.evony.common.beans.ColonyBean(arg2.colonyBeans[loc1]);
                    this.colonyBeansArray.addItem(loc2);
                    ++loc1;
                }
            }
            return;
        }

        public override function toDebugString(arg1:String=""):String
        {
            var loc1:*=0;
            var loc2:*="---- ColonyUpdate ----\n";
            loc2 = loc2 + (arg1 + "castleId = " + this.castleId + "\n");
            loc1 = 0;
            while (loc1 < this.colonyBeansArray.length) 
            {
                loc2 = loc2 + this.getColonyBeans(loc1).toDebugString(arg1 + "colonyBeans[" + loc1 + "].");
                ++loc1;
            }
            return loc2;
        }

        public function toObject():Object
        {
            var loc1:*=new Object();
            loc1.castleId = this.castleId;
            return loc1;
        }

        public function getColonyBeans(arg1:int):com.evony.common.beans.ColonyBean
        {
            var loc1:*=this.colonyBeansArray[arg1] as com.evony.common.beans.ColonyBean;
            return loc1;
        }

        public function setColonyBeans(arg1:com.evony.common.beans.ColonyBean, arg2:int):void
        {
            this.colonyBeansArray[arg2] = arg1;
            return;
        }

        public function copyTo(arg1:com.evony.common.server.events.ColonyUpdate):void
        {
            arg1.castleId = this.castleId;
            com.evony.common.CommonUtil.arrayCopy(this.colonyBeansArray, arg1.colonyBeansArray);
            return;
        }

        public var colonyBeansArray:mx.collections.ArrayCollection;

        public var castleId:int;
    }
}
